package com.company.JDBC高级;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class sourceDemo动态代理 {
    public static void main(String[] args) throws SQLException {
        sourceImpl动态代理 source = new sourceImpl动态代理();
        System.out.println(source.getSize());
        Connection con = source.getConnection();
        PreparedStatement pst = con.prepareStatement("SELECT * FROM student");
        ResultSet rs = pst.executeQuery();
        while (rs.next()) {
            System.out.println(rs.getInt("sid") + "\t" +
                            rs.getString("name") + "\t" +
                            rs.getInt("age") + "\t" +
                            rs.getDate("birthday") + "\t"
                    );
        }
        con.close();
        System.out.println(source.getSize());
        System.out.println(con.getClass());
    }
}
